package com.cennavi.mineplay.utils;

import java.io.File;

public class test {

//	public static void main(String[] args) throws Exception {
//		Class.forName("org.postgresql.Driver");
//
//		Connection conn = DriverManager.getConnection(
//				"jdbc:postgresql://36.111.84.170:5442/test1", "postgres",
//				"cennavi2018");
//
//		String sql = "select objectid,cast(x as float) as x,cast(y as float) as y,cast(z as float) as z from object_geo_line where objectid in "
//				+ "( select objectid  from ( select * from object_geo_line where objectid "
//				+ " in (select objectid from had_object where obj_type='6') order by objectid,seqnum ) as "
//				+ "foo group by objectid  having count(*) = 5 ) order by objectid, seqnum";
//		
//		
//		System.out.println(sql);
//		
//		PrintWriter out = new PrintWriter(new FileOutputStream("c:/flag.json"));
//		
//		Statement stmt = conn.createStatement();
//		
//		ResultSet rs = stmt.executeQuery(sql);
//		
//		int row = 0;
//		
//		double[][] ps = new double[5][];
//		
//		while(rs.next()){
//			double x = rs.getDouble("x");
//			double y = rs.getDouble("y");
//			double z = rs.getDouble("z");
//			
//			System.out.println(rs.getString("objectid"));
//			
//			ps[row++] = new double[]{x,y,z};
//			
//			if (row==5){
//				 
//				test1(ps,out);
//				row = 0;
//			}
//		}
//		
//		out.flush();
//		
//		out.flush();
//
//	}
//	
//	
//	static void test1(double[][] ps,PrintWriter out){
//		
//		String str = "[";
//		//左下
//		if (Math.abs(ps[0][2] - ps[1][2]) < (ps[3][2] - ps[0][2]) && (ps[3][2] > ps[0][2])){
//			str += "[" + ps[3][0]+","+ps[3][1]+"],";
//			str += "[" + ps[0][0]+","+ps[0][1]+"],";
//			str += "[" + ps[1][0]+","+ps[1][1]+"],";
//			str += "[" + ps[2][0]+","+ps[2][1]+"]]";
//		}else if (Math.abs(ps[0][2] - ps[3][2]) < (ps[1][2] - ps[0][2]) && (ps[1][2] > ps[0][2])){
//			//右下
//			str += "[" + ps[2][0]+","+ps[2][1]+"],";
//			str += "[" + ps[3][0]+","+ps[3][1]+"],";
//			str += "[" + ps[0][0]+","+ps[0][1]+"],";
//			str += "[" + ps[1][0]+","+ps[1][1]+"]]";
//		}else if (Math.abs(ps[0][2] - ps[1][2]) < (ps[0][2] - ps[3][2]) && (ps[3][2] < ps[0][2])){
//			//右上
//			str += "[" + ps[1][0]+","+ps[1][1]+"],";
//			str += "[" + ps[2][0]+","+ps[2][1]+"],";
//			str += "[" + ps[3][0]+","+ps[3][1]+"],";
//			str += "[" + ps[0][0]+","+ps[0][1]+"]]";
//		}else{
//			str += "[" + ps[0][0]+","+ps[0][1]+"],";
//			str += "[" + ps[1][0]+","+ps[1][1]+"],";
//			str += "[" + ps[2][0]+","+ps[2][1]+"],";
//			str += "[" + ps[3][0]+","+ps[3][1]+"]]";
//		}
//		
//		out.print(str);
//		out.print(",");
//	}
	
//	public static void main(String[] args) throws Exception{
//		File[] fs = new File("d:/").listFiles();
//		
//		for(File f: fs){
//			System.out.println(f.getName());
//		}
//	}

}
